Derive Rotation Angle
Continuing to work with the generalized conic
$$Ax^{2}+Bxy+Cy^{2}+Dx+Ey+F=0. \tag{1} \label{1}$$
We have said that when the coefficient $B$ is not zero that the conic is rotated and we have said that the angle needed to align it is given by
$$\cot(2\theta)=\frac{cos(2\theta)}{sin(2\theta)}=\frac{A-C}{B}.$$
Proof. We have previously shown that a conic equation can be rotated by substituting for $x$ and $y$ values that cause the axes to be rotated. The specific substitution is
$$\begin{array}{c}
x=x_{1}\cos(\theta)-y_{1}\sin(\theta)\\
y=x_{1}\sin(\theta)+y_{1}\cos(\theta)
\end{array} \tag{2} \label{2}$$
and these values for $x$ and $y$ are substituted into $\eqref{1}$.
$$\begin{aligned} & A\;\left(x\cos\left(\theta\right)+y\sin\left(\theta\right)\right)^{2}\\
& +B\;\left(x\sin\left(\theta\right)-y\cos\left(\theta\right)\right)\left(x\cos\left(\theta\right)+y\sin\left(\theta\right)\right)\\
& +C\;\left(x\sin\left(\theta\right)-y\cos\left(\theta\right)\right)^{2}\\
& +D\;\left(x\cos\left(\theta\right)+y\sin\left(\theta\right)\right)\\
& +E\;\left(x\sin\left(\theta\right)-y\cos\left(\theta\right)\right)\\
& +F=0
\end{aligned}
$$
We are only going to care about the $xy$ term and really only about the coefficient of that term. The coefficient of $D$ and $E$ and $F$ cannot have an $xy$ term so let's ignore those. Meanwhile we will expand the part with $A$, $B$, and $C$.
$$\begin{aligned} & A\;x^{2}\cos(\theta)^{2}\\
& +2\;A\;x\;y\cos\left(\theta\right)\sin\left(\theta\right)\\
& +A\;y^{2}\sin(\theta)^{2}\\
& +B\;x^{2}\cos\left(\theta\right)\sin\left(\theta\right)\\
& -B\;x\;y\cos(\theta)^{2}\\
& +B\;x\;y\sin(\theta)^{2}\\
& -B\;y^{2}\cos\left(\theta\right)\sin\left(\theta\right)\\
& +C\;x^{2}\sin(\theta)^{2}\\
& -2\;C\;x\;y\cos\left(\theta\right)\sin\left(\theta\right)\\
& +C\;y^{2}\cos(\theta)^{2}
\end{aligned}
$$
Now factor that for $xy$ and equate the coefficient to zero so that we can get the coefficient of $B$ to go away.
Here we show the factros of $xy$.
$$ x\cdot y\cdot\left(2\;A\cos\left(\theta\right)\sin\left(\theta\right)-B\cos(\theta)^{2}+B\sin(\theta)^{2}-2\;C\cos\left(\theta\right)\sin\left(\theta\right)\right)$$
Now we separate away the coefficient and equate it to zero.
$$2\;A\cos\left(\theta\right)\sin\left(\theta\right)-B\cos(\theta)^{2}+B\sin(\theta)^{2}-2\;C\cos\left(\theta\right)\sin\left(\theta\right)=0$$
Next we do some algebra to get
$$B\sin(\theta)^{2}-B\cos(\theta)^{2}+2\left(A-C\right)\sin\left(\theta\right)\cos\left(\theta\right)=0$$
and
$$\frac{\cos^{2}(\theta)-\sin^{2}(\theta)}{2\sin\left(\theta\right)\cos\left(\theta\right)}=\frac{A-C}{B}$$
Now we will use some trig identities for the numerator and denominator.
$$\frac{\cos(2\theta)}{\sin(2\theta)}=\cot(2\theta)=\frac{A-C}{B}\qquad \square$$